@dataknut)Please note that authorship is alphabetical. Contributions are listed below - see github for details and who to blame for what :-).
@dataknut)If you wish to refer to any of the material from this report please cite as:
Report circulation:
Report purpose:
This work is (c) 2019 the University of Southampton.
# done in makefile
Data downloaded from http://southampton.my-air.uk. See also https://www.southampton.gov.uk/environmental-issues/pollution/air-quality/.
Southampton City Council collects various forms of air quality data at the sites shown in 2.1. WHO publishes information on the health consequences and “acceptable” exposure levels for each of these.
lDT <- data.table::melt(dt, id.vars = c("site", "obsDateTime"), measure.vars = c("co", "nox", "nox2", "noxes", "oz", "pm10",
"pm2_5", "so2"), value.name = "value" # varies
)
# remove NA
lDT <- lDT[!is.na(value)]
t <- lDT[, .(from = min(obsDateTime), to = max(obsDateTime), nObs = .N), keyby = .(site, variable)]
kableExtra::kable(t, caption = "Dates data available by site and measure", digits = 2) %>% kable_styling()
| site | variable | from | to | nObs |
|---|---|---|---|---|
| Southampton - A33 Roadside AURN | nox | 2016-01-26 11:00:00 | 2019-12-04 22:00:00 | 33046 |
| Southampton - A33 Roadside AURN | nox2 | 2016-01-26 11:00:00 | 2019-12-04 22:00:00 | 33034 |
| Southampton - A33 Roadside AURN | pm10 | 2016-01-04 13:00:00 | 2019-12-04 21:00:00 | 31985 |
| Southampton - Onslow Road | nox | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 33509 |
| Southampton - Onslow Road | nox2 | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 33505 |
| Southampton - Onslow Road | noxes | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 33509 |
| Southampton - Victoria Road | nox | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 25224 |
| Southampton - Victoria Road | nox2 | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 25224 |
| Southampton - Victoria Road | noxes | 2016-01-01 00:00:00 | 2019-12-20 18:00:00 | 25224 |
| Southampton Background AURN | nox | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 27948 |
| Southampton Background AURN | nox2 | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 27961 |
| Southampton Background AURN | noxes | 2016-01-01 00:00:00 | 2019-01-01 00:00:00 | 20026 |
| Southampton Background AURN | oz | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 27847 |
| Southampton Background AURN | pm10 | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 24397 |
| Southampton Background AURN | pm2_5 | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 26605 |
| Southampton Background AURN | so2 | 2016-01-01 00:00:00 | 2019-12-04 22:00:00 | 27399 |
Summarise previously downloaded and processed data… Note that this may not be completely up to date.
skimr::skim(dt)
| Name | dt |
| Number of rows | 209832 |
| Number of columns | 10 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| logical | 1 |
| numeric | 7 |
| POSIXct | 1 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| site | 0 | 1 | 22 | 31 | 0 | 6 | 0 |
Variable type: logical
| skim_variable | n_missing | complete_rate | mean | count |
|---|---|---|---|---|
| co | 209832 | 0 | NaN | : |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| nox | 90105 | 0.57 | 26.61 | 40.23 | -5.0 | 4.7 | 13.4 | 32.1 | 746.3 | ▇▁▁▁▁ |
| nox2 | 90108 | 0.57 | 37.00 | 22.54 | -1.3 | 20.5 | 33.0 | 48.8 | 287.5 | ▇▂▁▁▁ |
| noxes | 131073 | 0.38 | 76.59 | 74.87 | -1.4 | 32.8 | 56.9 | 94.1 | 1431.8 | ▇▁▁▁▁ |
| pm10 | 153450 | 0.27 | 18.71 | 13.18 | -3.5 | 10.9 | 15.8 | 23.1 | 761.6 | ▇▁▁▁▁ |
| oz | 181985 | 0.13 | 40.50 | 23.12 | -0.2 | 23.9 | 41.2 | 56.0 | 174.1 | ▆▇▁▁▁ |
| pm2_5 | 183227 | 0.13 | 12.15 | 9.58 | -4.0 | 6.6 | 9.5 | 14.4 | 289.2 | ▇▁▁▁▁ |
| so2 | 182433 | 0.13 | 3.01 | 3.36 | -1.1 | 0.9 | 1.7 | 3.7 | 50.5 | ▇▁▁▁▁ |
Variable type: POSIXct
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDateTime | 0 | 1 | 2016-01-01 | 2019-12-31 | 2017-12-30 12:30:00 | 34972 |
t <- dt[, .(`co: Carbon Monoxide, mg/m3` = mean(co, na.rm = TRUE), `nox = Nitric Oxide, ug/m3` = mean(nox, na.rm = TRUE),
`nox2 = Nitrogen Dioxide, ug/m3` = mean(nox2, na.rm = TRUE), `noxes = Oxides of Nitrogen, ug/m3` = mean(noxes, na.rm = TRUE),
`oz = ozone, ug/m3` = mean(oz, na.rm = TRUE), `pm10, ug/m3` = mean(pm10, na.rm = TRUE), `pm2_5, ug/m3` = mean(pm2_5,
na.rm = TRUE), `so2 = Sulphur Dioxide, ug/m3` = mean(so2, na.rm = TRUE)), keyby = .(site)]
kableExtra::kable(t, caption = "Mean values per site (NaN indicates not measured)") %>% kable_styling()
| site | co: Carbon Monoxide, mg/m3 | nox = Nitric Oxide, ug/m3 | nox2 = Nitrogen Dioxide, ug/m3 | noxes = Oxides of Nitrogen, ug/m3 | oz = ozone, ug/m3 | pm10, ug/m3 | pm2_5, ug/m3 | so2 = Sulphur Dioxide, ug/m3 |
|---|---|---|---|---|---|---|---|---|
| Southampton - A33 Roadside AURN | NaN | 34.00597 | 35.79520 | NaN | NaN | 19.04556 | NaN | NaN |
| Southampton - Bitterne | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Southampton - Onslow Road | NaN | 29.84889 | 42.20433 | 87.97470 | NaN | NaN | NaN | NaN |
| Southampton - Redbridge | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Southampton - Victoria Road | NaN | 27.43040 | 39.90371 | 81.96375 | NaN | NaN | NaN | NaN |
| Southampton Background AURN | NaN | 13.24819 | 29.55140 | 50.78906 | 40.50492 | 18.27441 | 12.15377 | 3.014884 |
Table 3.1 gives an indication of the availability of the different measures.
In this section we present graphical analysis of the previoulsy downloaded data. Note this is just a snapshot of the data available.
yLab <- "Nitrogen Dioxide (ug/m3)"
t <- lDT[variable == "nox2", .(mean = mean(value, na.rm = TRUE), sd = sd(value, na.rm = TRUE), min = min(value, na.rm = TRUE),
max = max(value, na.rm = TRUE)), keyby = .(site)]
kableExtra::kable(t, caption = "Summary of nox2 data") %>% kable_styling()
| site | mean | sd | min | max |
|---|---|---|---|---|
| Southampton - A33 Roadside AURN | 35.79520 | 25.00895 | 0.0 | 164.3 |
| Southampton - Onslow Road | 42.20433 | 21.09972 | 1.2 | 241.3 |
| Southampton - Victoria Road | 39.90371 | 23.96440 | -1.3 | 287.5 |
| Southampton Background AURN | 29.55140 | 16.94370 | 2.3 | 144.2 |
Table 4.1 suggests that there may be a few (5) negative values. These are summarised in 4.2 while Figure 4.1 shows the availability and levels of the pollutant data over time.
t <- head(dt[nox2 < 0], 10)
kableExtra::kable(t, caption = "Negative nox2 values (up to first 6)") %>% kable_styling()
| nox | nox2 | noxes | pm10 | site | co | oz | pm2_5 | so2 | obsDateTime |
|---|---|---|---|---|---|---|---|---|---|
| 0.4 | -0.1 | 0.6 | NA | Southampton - Victoria Road | NA | NA | NA | NA | 2016-01-29 04:00:00 |
| 0.8 | -0.5 | 0.7 | NA | Southampton - Victoria Road | NA | NA | NA | NA | 2016-11-27 05:00:00 |
| 0.9 | -1.1 | 0.3 | NA | Southampton - Victoria Road | NA | NA | NA | NA | 2016-11-27 06:00:00 |
| 1.5 | -0.2 | 2.1 | NA | Southampton - Victoria Road | NA | NA | NA | NA | 2017-02-06 00:00:00 |
| 1.1 | -1.3 | 0.3 | NA | Southampton - Victoria Road | NA | NA | NA | NA | 2017-02-06 01:00:00 |
t <- table(dt[nox < 0]$site)
kableExtra::kable(t, caption = "Negative nox2 values (count by site)") %>% kable_styling()
| Var1 | Freq |
|---|---|
| Southampton - Onslow Road | 248 |
| Southampton - Victoria Road | 168 |
# dt,xvar, yvar,fillVar, yLab
p <- makeTilePlot(lDT[variable == "nox2"], xVar = "obsDateTime", yVar = "site", fillVar = "value", yLab = yLab)
p
Figure 4.1: Nitrogen Dioxide data availability and levels over time
# p <- ggplot2::ggplot(dt, aes(x = obsDateTime, y = nox2, colour = site, alpha = 0.1)) + geom_point(shape=4, size = 1)
t <- lDT[variable == "nox2" & value > 200][order(-value)]
kableExtra::kable(caption = paste0("Values greater than WHO threshold (NO2 > ", hourlyno2Threshold_WHO, ")"), head(t, 10)) %>%
kable_styling()
| site | obsDateTime | variable | value |
|---|---|---|---|
| Southampton - Victoria Road | 2016-11-30 17:00:00 | nox2 | 287.5 |
| Southampton - Victoria Road | 2016-11-30 19:00:00 | nox2 | 275.3 |
| Southampton - Victoria Road | 2016-11-30 18:00:00 | nox2 | 268.7 |
| Southampton - Victoria Road | 2017-01-05 18:00:00 | nox2 | 251.6 |
| Southampton - Victoria Road | 2017-01-05 17:00:00 | nox2 | 247.3 |
| Southampton - Victoria Road | 2017-01-24 18:00:00 | nox2 | 243.5 |
| Southampton - Victoria Road | 2017-01-24 19:00:00 | nox2 | 242.0 |
| Southampton - Onslow Road | 2016-03-08 09:00:00 | nox2 | 241.3 |
| Southampton - Victoria Road | 2017-01-03 08:00:00 | nox2 | 234.4 |
| Southampton - Victoria Road | 2017-01-03 09:00:00 | nox2 | 232.8 |
p <- makeDotPlot(lDT[variable == "nox2"], xVar = "obsDateTime", yVar = "value", byVar = "site", yLab = yLab)
p <- p + geom_hline(yintercept = hourlyno2Threshold_WHO) + labs(caption = "Reference line = WHO hourly guideline threshold")
if (doPlotly) {
p
plotly::ggplotly(p + xlim(xlimMinDateTime, xlimMaxDateTime)) # interactive, xlimited
} else {
p
}
Figure 4.2: Nitrogen Dioxide levels, Southampton (hourly)
Figure 4.2 shows hourly values for all sites. In the study period there were 23 hours when the hourly Nitrogen Dioxide level breached WHO guidelines. The worst 10 cases are shown in Table 4.3.
lDT[, obsDate := lubridate::date(obsDateTime)]
plotDT <- lDT[variable == "nox2", .(mean = mean(value, na.rm = TRUE)),
keyby = .(obsDate, site)]
p <- makeDotPlot(plotDT,
xVar = "obsDate",
yVar = "mean",
byVar = "site",
yLab = yLab)
p <- p +
geom_smooth() + # add smoothed line
labs(caption = "Trend line = Generalized additive model (gam) with integrated smoothness estimation")
if(doPlotly){
p
plotly::ggplotly(p + xlim(xlimMinDate, xlimMaxDate)) # interactive, xlimited # interactive
} else {
p
}
Figure 4.3: Nitrogen Dioxide levels, Southampton (daily mean
Figure 4.3 shows daily mean values for all sites over time and includes smoother trend lines for each site.
Clearly the mean daily values show less variance (and less extremes) than the hourly data and there has also been a decreasing trend over time.
PM 10 data: has more sensors and wider coverage than PM2.5
yLab <- "PM 10 (ug/m3)"
t <- dt[, .(mean = mean(pm10, na.rm = TRUE), sd = sd(pm10, na.rm = TRUE), min = min(pm10, na.rm = TRUE), max = max(pm10,
na.rm = TRUE)), keyby = .(site)]
kableExtra::kable(t, caption = "Summary of pm10 data") %>% kable_styling()
| site | mean | sd | min | max |
|---|---|---|---|---|
| Southampton - A33 Roadside AURN | 19.04556 | 14.36815 | 0.0 | 761.6 |
| Southampton - Bitterne | NaN | NA | Inf | -Inf |
| Southampton - Onslow Road | NaN | NA | Inf | -Inf |
| Southampton - Redbridge | NaN | NA | Inf | -Inf |
| Southampton - Victoria Road | NaN | NA | Inf | -Inf |
| Southampton Background AURN | 18.27441 | 11.42768 | -3.5 | 344.1 |
Table 4.4 suggests that there may be a few (19) negative values. These are shown in 4.5 while 4.4 shows data availability and PM 10 levels over time at each site.
t <- head(dt[pm10 < 0], nrow(dt[pm10 < 0]))
kableExtra::kable(head(t), caption = "Negative PM10 values - first 6") %>% kable_styling()
| nox | nox2 | noxes | pm10 | site | co | oz | pm2_5 | so2 | obsDateTime |
|---|---|---|---|---|---|---|---|---|---|
| 4.9 | 17.5 | 25.0 | -0.9 | Southampton Background AURN | NA | 48.7 | -0.3 | 1.4 | 2016-04-16 10:00:00 |
| 3.1 | 15.1 | 19.8 | -2.0 | Southampton Background AURN | NA | 41.9 | 2.9 | 0.7 | 2016-06-12 06:00:00 |
| 5.7 | 15.3 | 24.0 | -2.1 | Southampton Background AURN | NA | 35.2 | 1.4 | 0.7 | 2016-06-12 07:00:00 |
| 1.0 | 8.6 | 10.1 | -1.2 | Southampton Background AURN | NA | 31.1 | 6.9 | 0.0 | 2017-06-11 03:00:00 |
| 5.0 | 13.4 | 21.0 | -0.1 | Southampton Background AURN | NA | 56.2 | 5.9 | 1.5 | 2017-06-30 11:00:00 |
| 1.1 | 11.2 | 12.9 | -0.6 | Southampton Background AURN | NA | 24.0 | 5.4 | 0.2 | 2017-07-04 02:00:00 |
p <- makeTilePlot(lDT[variable == "pm10"], xVar = "obsDateTime", yVar = "site", fillVar = "value", yLab = yLab)
p
Figure 4.4: Availability and level of PM 10 data over time
Figure 4.5 shows hourly PM 10 values for all sites and suggests there may be an extreme outlier (see Table 4.5).
t <- lDT[variable == "pm10" & value > 100][order(-value)]
kableExtra::kable(caption = "10 highest hourly values (PM 10 > 100)", head(t)) %>% kable_styling()
| site | obsDateTime | variable | value | obsDate |
|---|---|---|---|---|
| Southampton - A33 Roadside AURN | 2016-09-19 14:00:00 | pm10 | 761.6 | 2016-09-19 |
| Southampton - A33 Roadside AURN | 2016-08-09 14:00:00 | pm10 | 402.7 | 2016-08-09 |
| Southampton Background AURN | 2016-01-01 00:00:00 | pm10 | 344.1 | 2016-01-01 |
| Southampton - A33 Roadside AURN | 2017-05-05 01:00:00 | pm10 | 336.4 | 2017-05-05 |
| Southampton - A33 Roadside AURN | 2016-08-09 15:00:00 | pm10 | 328.0 | 2016-08-09 |
| Southampton - A33 Roadside AURN | 2016-08-09 04:00:00 | pm10 | 300.1 | 2016-08-09 |
p <- makeDotPlot(lDT[variable == "pm10"], xVar = "obsDateTime", yVar = "value", byVar = "site", yLab = yLab)
if (doPlotly) {
p
plotly::ggplotly(p + xlim(xlimMinDateTime, xlimMaxDateTime)) # interactive, xlimited # interactive
} else {
p
}
Figure 4.5: PM10 levels, Southampton (hourly)
pm10DT <- dt[!is.na(pm10)]
plotDT <- lDT[variable == "pm10", .(mean = mean(value, na.rm = TRUE)),
keyby = .(obsDate, site)]
extremePm10Daily <- plotDT[mean > dailyPm10Threshold_WHO][order(-mean)]
kableExtra::kable(caption = paste0("10 highest values greater than WHO threshold (PM 10 > ",
dailyPm10Threshold_WHO , ")"),
digits = 2,
head(extremePm10Daily, 10)) %>%
kable_styling()
| obsDate | site | mean |
|---|---|---|
| 2016-08-09 | Southampton - A33 Roadside AURN | 144.48 |
| 2017-06-19 | Southampton - A33 Roadside AURN | 143.66 |
| 2017-05-05 | Southampton - A33 Roadside AURN | 88.94 |
| 2016-09-19 | Southampton - A33 Roadside AURN | 88.46 |
| 2016-11-30 | Southampton - A33 Roadside AURN | 79.25 |
| 2016-03-12 | Southampton - A33 Roadside AURN | 72.00 |
| 2017-01-22 | Southampton - A33 Roadside AURN | 66.86 |
| 2019-02-27 | Southampton Background AURN | 64.67 |
| 2019-02-27 | Southampton - A33 Roadside AURN | 60.60 |
| 2019-04-17 | Southampton Background AURN | 58.37 |
p <- makeDotPlot(plotDT,
xVar = "obsDate",
yVar = "mean",
byVar = "site",
yLab = yLab)
p <- p +
geom_hline(yintercept = dailyPm10Threshold_WHO) +
geom_smooth() + # add smoothed line
labs(caption = "Trend line = Generalized additive model (gam) with integrated smoothness estimation")
if(doPlotly){
p
plotly::ggplotly(p + xlim(xlimMinDate, xlimMaxDate)) # interactive, xlimited # interactive
} else {
p
}
Figure 4.6: PM10 levels, Southampton (daily mean, WHO daily threshold shown in red - use mouse to hover over data)
Figure 4.6 shows daily values for all sites and indicates the 78 that cross the WHO PM10 daily mean exposure threshold (50) - see Table 4.7.
yLab <- "PM 2.5 (ug/m3)"
t <- dt[, .(mean = mean(pm2_5, na.rm = TRUE), sd = sd(pm2_5, na.rm = TRUE), min = min(pm2_5, na.rm = TRUE), max = max(pm2_5,
na.rm = TRUE)), keyby = .(site)]
kableExtra::kable(t, caption = "Summary of pm2_5 data") %>% kable_styling()
| site | mean | sd | min | max |
|---|---|---|---|---|
| Southampton - A33 Roadside AURN | NaN | NA | Inf | -Inf |
| Southampton - Bitterne | NaN | NA | Inf | -Inf |
| Southampton - Onslow Road | NaN | NA | Inf | -Inf |
| Southampton - Redbridge | NaN | NA | Inf | -Inf |
| Southampton - Victoria Road | NaN | NA | Inf | -Inf |
| Southampton Background AURN | 12.15377 | 9.584743 | -4 | 289.2 |
Table 4.8 suggests that there may be a few (89) negative values. These are shown in 4.9 while 4.7 shows data availability and PM 2.5 levels over time at each site.
t <- head(dt[pm2_5 < 0], nrow(dt[pm2_5 < 0]))
kableExtra::kable(head(t), caption = "Negative pm2_5 values - first 6") %>% kable_styling()
| nox | nox2 | noxes | pm10 | site | co | oz | pm2_5 | so2 | obsDateTime |
|---|---|---|---|---|---|---|---|---|---|
| 41.8 | 55.2 | 119.2 | 5.8 | Southampton Background AURN | NA | 16.8 | -0.8 | 4.5 | 2016-01-02 17:00:00 |
| 2.5 | 26.4 | 30.1 | 12.6 | Southampton Background AURN | NA | 48.1 | -0.9 | 0.2 | 2016-01-04 03:00:00 |
| 2.9 | 24.2 | 28.6 | 11.7 | Southampton Background AURN | NA | 44.0 | -0.3 | 0.8 | 2016-01-04 23:00:00 |
| 1.0 | 15.7 | 17.3 | 9.1 | Southampton Background AURN | NA | 49.8 | -1.0 | 1.1 | 2016-01-05 01:00:00 |
| 2.5 | 14.5 | 18.3 | 7.8 | Southampton Background AURN | NA | 69.5 | -0.3 | 4.6 | 2016-01-09 22:00:00 |
| 3.5 | 18.2 | 23.6 | 5.6 | Southampton Background AURN | NA | 60.8 | -0.9 | 4.9 | 2016-01-09 23:00:00 |
p <- makeTilePlot(lDT[variable == "pm2_5"], xVar = "obsDateTime", yVar = "site", fillVar = "value", yLab = yLab)
p
Figure 4.7: Availability and level of PM 10 data over time
Figure 4.8 shows hourly values for all sites.
t <- lDT[variable == "pm2_5" & value > 200][order(-value)]
kableExtra::kable(caption = "Extreme hourly values (PM 2.5 > 50)", t) %>% kable_styling()
| site | obsDateTime | variable | value | obsDate |
|---|---|---|---|---|
| Southampton Background AURN | 2016-01-01 00:00:00 | pm2_5 | 289.2 | 2016-01-01 |
| Southampton Background AURN | 2019-10-27 20:00:00 | pm2_5 | 239.1 | 2019-10-27 |
p <- makeDotPlot(lDT[variable == "pm2_5"], xVar = "obsDateTime", yVar = "value", byVar = "site", yLab = yLab)
if (doPlotly) {
p
plotly::ggplotly(p + xlim(xlimMinDateTime, xlimMaxDateTime)) # interactive, xlimited # interactive
} else {
p
}
Figure 4.8: PM2_5 levels, Southampton (hourly - use mouse to hover over data)
plotDT <- lDT[variable == "pm2_5", .(mean = mean(value, na.rm = TRUE)),
keyby = .(obsDate, site)]
extremePm25Daily <- plotDT[mean > dailyPm2.5Threshold_WHO][order(-mean)]
kableExtra::kable(caption = paste0("10 highest values greater than WHO threshold (PM 2.5 > ",
dailyPm2.5Threshold_WHO , ")"),
digits = 2,
head(extremePm25Daily,10)) %>%
kable_styling()
| obsDate | site | mean |
|---|---|---|
| 2016-03-12 | Southampton Background AURN | 64.79 |
| 2019-04-17 | Southampton Background AURN | 49.04 |
| 2016-03-13 | Southampton Background AURN | 47.79 |
| 2019-04-07 | Southampton Background AURN | 46.90 |
| 2019-02-27 | Southampton Background AURN | 43.64 |
| 2019-03-29 | Southampton Background AURN | 43.60 |
| 2019-04-22 | Southampton Background AURN | 42.92 |
| 2017-02-12 | Southampton Background AURN | 42.25 |
| 2018-04-21 | Southampton Background AURN | 41.96 |
| 2016-03-11 | Southampton Background AURN | 41.80 |
p <- makeDotPlot(plotDT,
xVar = "obsDate",
yVar = "mean",
byVar = "site",
yLab = yLab)
p <- p +
geom_hline(yintercept = dailyPm2.5Threshold_WHO) +
geom_smooth() + #add smoothed line
labs(caption = "Trend line = Generalized additive model (gam) with integrated smoothness estimation")
if(doPlotly){
p
plotly::ggplotly(p + xlim(xlimMinDate, xlimMaxDate)) # interactive, xlimited # interactive
} else {
p
}
Figure 4.9: PM2_5 levels, Southampton (daily mean)
Figure 4.9 shows daily values for all sites and indicates that the WHO PM2_5 daily mean exposure threshold (25) was breached on 2 days. The 10 worst cases are shown in Table 4.11.
t <- lDT[variable == "nox2"]
skim(t)
| Name | t |
| Number of rows | 119724 |
| Number of columns | 5 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| Date | 1 |
| factor | 1 |
| numeric | 1 |
| POSIXct | 1 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| site | 0 | 1 | 25 | 31 | 0 | 4 | 0 |
Variable type: Date
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDate | 0 | 1 | 2016-01-01 | 2019-12-20 | 2018-01-16 | 1447 |
Variable type: factor
| skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
|---|---|---|---|---|---|
| variable | 0 | 1 | FALSE | 1 | nox: 119724, co: 0, nox: 0, nox: 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| value | 0 | 1 | 37 | 22.54 | -1.3 | 20.5 | 33 | 48.8 | 287.5 | ▇▂▁▁▁ |
Variable type: POSIXct
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDateTime | 0 | 1 | 2016-01-01 | 2019-12-20 18:00:00 | 2018-01-16 15:30:00 | 34723 |
t <- lDT[variable == "nox2" & value > hourlyno2Threshold_WHO][order(-value)]
kableExtra::kable(caption = paste0("Values greater than WHO threshold (NO2 > ", hourlyno2Threshold_WHO, ")"), t) %>% kable_styling()
| site | obsDateTime | variable | value | obsDate |
|---|---|---|---|---|
| Southampton - Victoria Road | 2016-11-30 17:00:00 | nox2 | 287.5 | 2016-11-30 |
| Southampton - Victoria Road | 2016-11-30 19:00:00 | nox2 | 275.3 | 2016-11-30 |
| Southampton - Victoria Road | 2016-11-30 18:00:00 | nox2 | 268.7 | 2016-11-30 |
| Southampton - Victoria Road | 2017-01-05 18:00:00 | nox2 | 251.6 | 2017-01-05 |
| Southampton - Victoria Road | 2017-01-05 17:00:00 | nox2 | 247.3 | 2017-01-05 |
| Southampton - Victoria Road | 2017-01-24 18:00:00 | nox2 | 243.5 | 2017-01-24 |
| Southampton - Victoria Road | 2017-01-24 19:00:00 | nox2 | 242.0 | 2017-01-24 |
| Southampton - Onslow Road | 2016-03-08 09:00:00 | nox2 | 241.3 | 2016-03-08 |
| Southampton - Victoria Road | 2017-01-03 08:00:00 | nox2 | 234.4 | 2017-01-03 |
| Southampton - Victoria Road | 2017-01-03 09:00:00 | nox2 | 232.8 | 2017-01-03 |
| Southampton - Victoria Road | 2017-01-05 19:00:00 | nox2 | 226.6 | 2017-01-05 |
| Southampton - Victoria Road | 2016-11-30 16:00:00 | nox2 | 222.6 | 2016-11-30 |
| Southampton - Victoria Road | 2016-12-29 09:00:00 | nox2 | 218.7 | 2016-12-29 |
| Southampton - Onslow Road | 2016-03-08 08:00:00 | nox2 | 216.0 | 2016-03-08 |
| Southampton - Victoria Road | 2017-01-05 20:00:00 | nox2 | 214.3 | 2017-01-05 |
| Southampton - Victoria Road | 2017-01-24 20:00:00 | nox2 | 212.7 | 2017-01-24 |
| Southampton - Victoria Road | 2016-11-30 09:00:00 | nox2 | 209.9 | 2016-11-30 |
| Southampton - Onslow Road | 2016-03-12 22:00:00 | nox2 | 208.5 | 2016-03-12 |
| Southampton - Onslow Road | 2016-03-08 07:00:00 | nox2 | 208.1 | 2016-03-08 |
| Southampton - Victoria Road | 2016-11-30 20:00:00 | nox2 | 207.0 | 2016-11-30 |
| Southampton - Onslow Road | 2016-02-19 08:00:00 | nox2 | 206.3 | 2016-02-19 |
| Southampton - Victoria Road | 2016-01-19 19:00:00 | nox2 | 204.4 | 2016-01-19 |
| Southampton - Onslow Road | 2016-03-21 08:00:00 | nox2 | 202.8 | 2016-03-21 |
t <- lDT[variable == "pm10"]
skim(t)
| Name | t |
| Number of rows | 56382 |
| Number of columns | 5 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| Date | 1 |
| factor | 1 |
| numeric | 1 |
| POSIXct | 1 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| site | 0 | 1 | 27 | 31 | 0 | 2 | 0 |
Variable type: Date
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDate | 0 | 1 | 2016-01-01 | 2019-12-04 | 2018-02-12 | 1410 |
Variable type: factor
| skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
|---|---|---|---|---|---|
| variable | 0 | 1 | FALSE | 1 | pm1: 56382, co: 0, nox: 0, nox: 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| value | 0 | 1 | 18.71 | 13.18 | -3.5 | 10.9 | 15.8 | 23.1 | 761.6 | ▇▁▁▁▁ |
Variable type: POSIXct
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDateTime | 0 | 1 | 2016-01-01 | 2019-12-04 22:00:00 | 2018-02-12 23:00:00 | 33494 |
kableExtra::kable(caption = paste0("PM 10 values greater than WHO threshold (NO2 > ", hourlyno2Threshold_WHO, ")"), extremePm10Daily) %>%
kable_styling()
| obsDate | site | mean |
|---|---|---|
| 2016-08-09 | Southampton - A33 Roadside AURN | 144.48125 |
| 2017-06-19 | Southampton - A33 Roadside AURN | 143.66000 |
| 2017-05-05 | Southampton - A33 Roadside AURN | 88.94348 |
| 2016-09-19 | Southampton - A33 Roadside AURN | 88.45625 |
| 2016-11-30 | Southampton - A33 Roadside AURN | 79.25417 |
| 2016-03-12 | Southampton - A33 Roadside AURN | 72.00000 |
| 2017-01-22 | Southampton - A33 Roadside AURN | 66.86250 |
| 2019-02-27 | Southampton Background AURN | 64.67143 |
| 2019-02-27 | Southampton - A33 Roadside AURN | 60.59524 |
| 2019-04-17 | Southampton Background AURN | 58.37083 |
| 2016-12-01 | Southampton - A33 Roadside AURN | 54.80833 |
| 2017-01-26 | Southampton - A33 Roadside AURN | 53.90000 |
| 2019-03-29 | Southampton Background AURN | 53.69167 |
| 2017-12-19 | Southampton Background AURN | 53.66250 |
| 2016-12-06 | Southampton - A33 Roadside AURN | 53.45000 |
| 2019-04-17 | Southampton - A33 Roadside AURN | 53.08750 |
| 2019-04-07 | Southampton Background AURN | 52.94167 |
| 2018-04-21 | Southampton Background AURN | 52.32083 |
| 2019-03-30 | Southampton Background AURN | 51.66250 |
| 2019-04-22 | Southampton Background AURN | 50.86250 |
| 2019-02-23 | Southampton Background AURN | 50.21667 |
t <- lDT[variable == "pm2_5"]
skim(t)
| Name | t |
| Number of rows | 26605 |
| Number of columns | 5 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| Date | 1 |
| factor | 1 |
| numeric | 1 |
| POSIXct | 1 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| site | 0 | 1 | 27 | 27 | 0 | 1 | 0 |
Variable type: Date
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDate | 0 | 1 | 2016-01-01 | 2019-12-04 | 2018-04-20 | 1131 |
Variable type: factor
| skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
|---|---|---|---|---|---|
| variable | 0 | 1 | FALSE | 1 | pm2: 26605, co: 0, nox: 0, nox: 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| value | 0 | 1 | 12.15 | 9.58 | -4 | 6.6 | 9.5 | 14.4 | 289.2 | ▇▁▁▁▁ |
Variable type: POSIXct
| skim_variable | n_missing | complete_rate | min | max | median | n_unique |
|---|---|---|---|---|---|---|
| obsDateTime | 0 | 1 | 2016-01-01 | 2019-12-04 22:00:00 | 2018-04-20 15:00:00 | 26605 |
kableExtra::kable(caption = paste0("PM 2.5 values greater than WHO threshold (NO2 > ", hourlyno2Threshold_WHO, ")"), extremePm25Daily) %>%
kable_styling()
| obsDate | site | mean |
|---|---|---|
| 2016-03-12 | Southampton Background AURN | 64.79167 |
| 2019-04-17 | Southampton Background AURN | 49.04167 |
| 2016-03-13 | Southampton Background AURN | 47.79167 |
| 2019-04-07 | Southampton Background AURN | 46.90417 |
| 2019-02-27 | Southampton Background AURN | 43.63810 |
| 2019-03-29 | Southampton Background AURN | 43.59583 |
| 2019-04-22 | Southampton Background AURN | 42.92500 |
| 2017-02-12 | Southampton Background AURN | 42.24583 |
| 2018-04-21 | Southampton Background AURN | 41.96250 |
| 2016-03-11 | Southampton Background AURN | 41.80000 |
| 2019-04-16 | Southampton Background AURN | 41.77500 |
| 2019-03-30 | Southampton Background AURN | 40.80000 |
| 2017-12-19 | Southampton Background AURN | 40.45833 |
| 2016-01-20 | Southampton Background AURN | 39.66667 |
| 2017-09-26 | Southampton Background AURN | 39.12083 |
| 2017-03-27 | Southampton Background AURN | 38.15833 |
| 2019-04-08 | Southampton Background AURN | 37.65833 |
| 2019-04-18 | Southampton Background AURN | 37.00417 |
| 2019-02-15 | Southampton Background AURN | 36.48571 |
| 2019-02-23 | Southampton Background AURN | 35.80833 |
| 2018-05-08 | Southampton Background AURN | 35.52917 |
| 2018-05-07 | Southampton Background AURN | 35.44583 |
| 2017-02-13 | Southampton Background AURN | 35.42083 |
| 2018-05-06 | Southampton Background AURN | 34.07917 |
| 2016-03-17 | Southampton Background AURN | 33.73333 |
| 2018-04-11 | Southampton Background AURN | 33.45000 |
| 2019-01-24 | Southampton Background AURN | 33.33750 |
| 2018-04-14 | Southampton Background AURN | 33.20417 |
| 2018-12-27 | Southampton Background AURN | 33.03333 |
| 2018-11-22 | Southampton Background AURN | 32.90833 |
| 2017-02-11 | Southampton Background AURN | 32.72917 |
| 2017-04-08 | Southampton Background AURN | 32.65833 |
| 2019-12-02 | Southampton Background AURN | 32.61667 |
| 2016-03-23 | Southampton Background AURN | 32.31667 |
| 2018-11-23 | Southampton Background AURN | 32.30417 |
| 2019-12-03 | Southampton Background AURN | 32.15417 |
| 2018-05-26 | Southampton Background AURN | 32.12083 |
| 2017-11-03 | Southampton Background AURN | 31.53333 |
| 2019-04-15 | Southampton Background AURN | 31.52917 |
| 2017-04-09 | Southampton Background AURN | 31.25417 |
| 2019-04-23 | Southampton Background AURN | 31.11250 |
| 2016-01-01 | Southampton Background AURN | 30.73750 |
| 2017-03-24 | Southampton Background AURN | 30.70833 |
| 2019-02-24 | Southampton Background AURN | 30.55417 |
| 2018-11-24 | Southampton Background AURN | 30.48333 |
| 2017-09-27 | Southampton Background AURN | 30.29583 |
| 2018-04-12 | Southampton Background AURN | 30.21667 |
| 2017-11-02 | Southampton Background AURN | 30.10833 |
| 2019-03-31 | Southampton Background AURN | 29.72500 |
| 2019-10-27 | Southampton Background AURN | 29.64167 |
| 2018-10-05 | Southampton Background AURN | 29.54167 |
| 2019-02-25 | Southampton Background AURN | 29.40000 |
| 2018-03-25 | Southampton Background AURN | 29.12083 |
| 2019-04-21 | Southampton Background AURN | 28.97083 |
| 2017-02-14 | Southampton Background AURN | 28.96250 |
| 2019-03-28 | Southampton Background AURN | 28.46250 |
| 2019-04-19 | Southampton Background AURN | 28.36250 |
| 2016-01-19 | Southampton Background AURN | 28.12917 |
| 2017-02-10 | Southampton Background AURN | 27.43333 |
| 2017-08-28 | Southampton Background AURN | 27.42500 |
| 2019-01-04 | Southampton Background AURN | 27.05000 |
| 2018-11-05 | Southampton Background AURN | 26.94167 |
| 2019-02-26 | Southampton Background AURN | 26.87391 |
| 2018-01-12 | Southampton Background AURN | 26.85417 |
| 2018-12-28 | Southampton Background AURN | 26.82500 |
| 2016-05-07 | Southampton Background AURN | 26.77500 |
| 2019-01-21 | Southampton Background AURN | 26.65000 |
| 2019-04-20 | Southampton Background AURN | 26.57917 |
| 2017-06-21 | Southampton Background AURN | 26.56667 |
| 2017-03-28 | Southampton Background AURN | 26.47500 |
| 2019-04-06 | Southampton Background AURN | 26.32917 |
| 2018-05-20 | Southampton Background AURN | 26.03333 |
| 2018-05-24 | Southampton Background AURN | 25.93750 |
| 2017-11-01 | Southampton Background AURN | 25.77500 |
| 2016-05-12 | Southampton Background AURN | 25.75000 |
| 2018-04-19 | Southampton Background AURN | 25.75000 |
| 2017-06-20 | Southampton Background AURN | 25.74167 |
| 2018-05-29 | Southampton Background AURN | 25.70833 |
| 2019-12-04 | Southampton Background AURN | 25.51304 |
| 2017-05-06 | Southampton Background AURN | 25.04167 |
Report generated using knitr in RStudio with R version 3.6.2 (2019-12-12) running on x86_64-apple-darwin15.6.0 (Darwin Kernel Version 17.7.0: Sun Dec 1 19:19:56 PST 2019; root:xnu-4570.71.63~1/RELEASE_X86_64).
t <- proc.time() - startTime
elapsed <- t[[3]]
Analysis completed in 29.179 seconds ( 0.49 minutes).
R packages used:
Arino de la Rubia, Eduardo, Hao Zhu, Shannon Ellis, Elin Waring, and Michael Quinn. 2017. Skimr: Skimr. https://github.com/ropenscilabs/skimr.
Dowle, M, A Srinivasan, T Short, S Lianoglou with contributions from R Saporta, and E Antonyan. 2015. Data.table: Extension of Data.frame. https://CRAN.R-project.org/package=data.table.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. http://www.jstatsoft.org/v40/i03/.
Müller, Kirill. 2017. Here: A Simpler Way to Find Your Files. https://CRAN.R-project.org/package=here.
Sievert, Carson, Chris Parmer, Toby Hocking, Scott Chamberlain, Karthik Ram, Marianne Corvellec, and Pedro Despouy. 2016. Plotly: Create Interactive Web Graphics via ’Plotly.js’. https://CRAN.R-project.org/package=plotly.
Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.
Zhu, Hao. 2018. KableExtra: Construct Complex Table with ’Kable’ and Pipe Syntax. https://CRAN.R-project.org/package=kableExtra.